package com.hospital.register.dto.core.api;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.hospital.register.dto.base.ApiBaseDto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Range;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.Future;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.PositiveOrZero;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 保存排班的参数
 *
 * @author 刘逸晖
 */
@Data
public class ScheduleSaveDto extends ApiBaseDto {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "科室编号")
    @NotBlank(message = "科室编号不可为空")
    private String depcode;

    @ApiModelProperty(value = "职称")
    @NotBlank(message = "职称不可为空")
    private String title;

    @ApiModelProperty(value = "医生名称")
    @NotBlank(message = "医生名称不可为空")
    private String docname;

    @ApiModelProperty(value = "擅长技能")
    private String skill;

    @ApiModelProperty(value = "排班日期")
    @NotNull(message = "排班日期不可为空")
    @Future(message = "排班日期必须是一个将来的日期")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date workDate;

    @ApiModelProperty(value = "排班时间（0：上午 1：下午）")
    @NotNull(message = "排班时间不可为空")
    @Range(min = 0L, max = 1L, message = "排班时间段非法")
    private Integer workTime;

    @ApiModelProperty(value = "可预约数")
    @NotNull(message = "可预约数不可为空")
    @PositiveOrZero(message = "可预约数必须 >= 0")
    private Integer reservedNumber;

    @ApiModelProperty(value = "剩余预约数")
    @NotNull(message = "剩余预约数不可为空")
    @PositiveOrZero(message = "剩余预约数必须 >= 0")
    private Integer availableNumber;

    @ApiModelProperty(value = "挂号费")
    @NotNull(message = "挂号费不可为空")
    @PositiveOrZero(message = "挂号费必须 >= 0")
    private BigDecimal amount;

    @ApiModelProperty(value = "排班状态（-1：停诊 0：停约 1：可约）")
    @NotNull(message = "排班状态不可为空")
    @Range(min = -1L, max = 1L, message = "排班状态非法")
    private Integer status;

    @ApiModelProperty(value = "排班编号（医院自己的排班主键）")
    private String hosScheduleId;

}

